package servlet.shopping;

import com.google.gson.Gson;
import dao.ProductDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@WebServlet(name = "ShoppingMessageServlet", value = "/ShoppingMessageServlet.s")
public class ShoppingMessageServlet extends HttpServlet {
    private ProductDao dao =new ProductDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String proid = request.getParameter("proid");
        final Map<String, Object> message = dao.getMessage(proid);
        final String json = new Gson().toJson(message);
        response.getWriter().append(json);
    }

}
